package org.example.bpp;

import org.springframework.beans.factory.config.BeanPostProcessor;
import org.springframework.cache.annotation.CacheConfig;

import java.lang.reflect.Proxy;

public class PrefixProcessor implements BeanPostProcessor {
    @Override
    public Object postProcessBeforeInitialization(Object bean, String beanName) {
        /*if (bean instanceof ConfigurableBean) {
            ((ConfigurableBean) bean).setName("PROD_" + bean.getName());
        }

        if (needProxy(bean.getClass())) {
            return Proxy.newProxyInstance(
                    bean.getClass().getClassLoader(),
                    bean.getClass().getInterfaces(),
                    (proxy, method, args) -> method.invoke(bean, args)
            );
        }

        Class<?> targetClass = bean.getClass();
        CacheConfig config = targetClass.getAnnotation(CacheConfig.class);
        if (config != null) {
            CacheManager.configure(config.ttl(), config.maxSize());
        }*/
        return bean;
    }
}
